<?php

/**
 * +-------------------------------------------------------------
 * |Caption:
 * +-------------------------------------------------------------
 * |Author: Lenny
 * +-------------------------------------------------------------
 * |Email:  1685964109@qq.com
 * +-------------------------------------------------------------
 * |Date:   2024/10/12 下午6:19
 * +-------------------------------------------------------------
 */

use think\facade\Route;

// 登录
Route::group('login', function () {
    Route::post('', 'Login/login');
    Route::get('out', 'Login/out');
    Route::get('captcha', 'Login/captcha');
});

// 用户管理
Route::group('user', function () {
    Route::get('list', 'User/list');
    Route::post('add', 'User/add');
    Route::post('edit', 'User/edit');
    Route::post('modify', 'User/modify');
    Route::post('del', 'User/del');
});

// 初始化
Route::group('init', function () {
    Route::get('', 'Init/index');
    Route::get('clear_cache', 'Init/clearCache');
});

// 角色管理
Route::group('auth', function () {
    Route::get('list', 'Auth/list');
    Route::post('add', 'Auth/add');
    Route::post('edit', 'Auth/edit');
    Route::post('modify', 'Auth/modify');
    Route::post('del', 'Auth/del');
});

// 菜单管理
Route::group('menu', function () {
    Route::get('list', 'Menu/list');
    Route::post('add', 'Menu/add');
    Route::post('edit', 'Menu/edit');
    Route::post('modify', 'Menu/modify');
    Route::post('del', 'Menu/del');
});


// 检索列表
Route::group('search', function () {
    // 经销商列表
    Route::get('dealer', 'Search/dealerList');
    // 供应商列表
    Route::get('supplier', 'Search/supplierList');
    // 门店列表
    Route::get('store', 'Search/storeList');
    // 片区列表
    Route::get('region', 'Search/regionList');
    // 司机列表
    Route::get('driver', 'Search/driverList');
    // 标品库列表
    Route::get('goods', 'Search/goodsList');
    // 集团列表
    Route::get('cate', 'Search/cateList');
    // 分类列表
    Route::get('dealer_cate', 'Search/dealerCateList');
    // 经销商产品列表
    Route::get('dealer_goods', 'Search/dealerGoodsList');
    // 经销商产品规格列表
    Route::get('dealer_goods_spec', 'Search/dealerGoodsSpecList');
    // 业务员列表
    Route::get('salesman', 'Search/salesmanList');
    // 用户角色权限
    Route::get('auth', 'Search/authList');
    // 用户角色
    Route::get('role', 'Search/roleList');
    // 品牌列表
    Route::get('brand', 'Search/brandList');
    // 仓库列表
    Route::get('warehouse', 'Search/warehouseList');
    // 经销商查询仓库列表
    Route::get('dealer_warehouse', 'Search/dealerWarehouseList');
    // 仓库库区列表
    Route::get('warehouse_area', 'Search/warehouseAreaList');
    // 仓库库位列表
    Route::get('warehouse_location', 'Search/warehouseLocationList');
    // 移动仓商品列表
    Route::get('warehouse_goods', 'Search/warehouseGoodsList');
    // 根据移动仓获取关联业务员
    Route::get('warehouse_salesman', 'Search/warehouseSalesmanList');
});

// 文件管理
Route::group('upload', function () {
    Route::get('list', 'Upload/list');
    Route::post('file', 'Upload/upload');
    Route::post('del', 'Upload/del');
});

// 日志管理
Route::group('log', function () {
    Route::get('list', 'Log/list');
});

// 供应商管理
Route::group('supplier', function () {
    Route::get('list', 'Supplier/list');
    Route::post('add', 'Supplier/add');
    Route::post('edit', 'Supplier/edit');
    Route::post('modify', 'Supplier/modify');
    Route::post('del', 'Supplier/del');
});

// 经销商管理
Route::group('dealer', function () {
    Route::get('list', 'Dealer/list');
    Route::post('add', 'Dealer/add');
    Route::post('edit', 'Dealer/edit');
    Route::post('modify', 'Dealer/modify');
    Route::post('del', 'Dealer/del');
});

// 门店管理
Route::group('store', function () {
    Route::get('list', 'Store/list');
    // 导出
    Route::get('export', 'Store/export');
    // 导入模版
    Route::get('template', 'Store/template');
    Route::post('add', 'Store/add');
    Route::post('edit', 'Store/edit');
    Route::post('modify', 'Store/modify');
    Route::post('del', 'Store/del');
    // 导入
    Route::post('import', 'Store/import');
});

// 片区管理
Route::group('region', function () {
    Route::get('list', 'Region/list');
    Route::get('store', 'Region/store');
    Route::post('add', 'Region/add');
    Route::post('edit', 'Region/edit');
    Route::post('modify', 'Region/modify');
    Route::post('del', 'Region/del');
    // 绑定门店
    Route::post('bind', 'Region/bind');
});

// 业务员管理
Route::group('salesman', function () {
    Route::get('list', 'Salesman/list');
    // 地图获取经销商业务员没有关联的门店
    Route::get('store', 'Salesman/store');
    Route::get('export', 'Salesman/export');
    // 获取未绑定的门店
    Route::get('unbound', 'Salesman/unbound');
    Route::post('import', 'Salesman/import');
    Route::post('add', 'Salesman/add');
    Route::post('edit', 'Salesman/edit');
    Route::post('modify', 'Salesman/modify');
    Route::post('del', 'Salesman/del');
    // 绑定门店
    Route::post('bind', 'Salesman/bind');
    // 解绑门店
    Route::post('unbind', 'Salesman/unbind');
});

// 司机管理
Route::group('driver', function () {
    Route::get('list', 'Driver/list');
    Route::post('add', 'Driver/add');
    Route::post('edit', 'Driver/edit');
    Route::post('modify', 'Driver/modify');
    Route::post('del', 'Driver/del');
});

// 经销商商品
Route::group('dealer_goods', function () {
    Route::get('list', 'DealerGoods/list');
    Route::get('template', 'DealerGoods/template');
    Route::get('export', 'DealerGoods/export');
    Route::post('import', 'DealerGoods/import');
    Route::post('add', 'DealerGoods/add');
    Route::post('edit', 'DealerGoods/edit');
    Route::post('modify', 'DealerGoods/modify');
    Route::post('del', 'DealerGoods/del');
    Route::post('del_spec', 'DealerGoods/delSpec');
});

// 订单
Route::group('order', function () {
    Route::get('list', 'Order/list');
    Route::post('add', 'Order/add');
    Route::post('edit', 'Order/edit');
    Route::post('modify', 'Order/modify');
    Route::post('del', 'Order/del');
    Route::post('check', 'Order/check');
});

// 出库单
Route::group('out_order', function () {
    Route::get('list', 'OutOrder/list');
    // 生成捡货单
    //    Route::post('pick', 'SaleOrder/pick');
    Route::post('pick', 'OutOrder/pick');
});

// 物流单
Route::group('delivery', function () {
    Route::get('list', 'Delivery/list');
    // 地图获取物流单门店配送数据
    Route::get('store', 'Delivery/store');
    // 分配司机
    Route::post('assign', 'Delivery/assign');
    // 批量分配司机
    Route::post('assign_commit', 'Delivery/assignCommit');
});

// 配送单
Route::group('task', function () {
    Route::get('list', 'Task/list');
    // 生成捡货单
    Route::post('pick', 'Task/pick');
    // 配送单驳回
    Route::post('review', 'Task/review');
});

// 销售单
Route::group('sale_order', function () {
    Route::get('list', 'SaleOrder/list');
    // 生成捡货单
    Route::post('pick', 'SaleOrder/pick');
    // 订单导入
    Route::post('import', 'SaleOrder/import');
    Route::get('template', 'SaleOrder/template');
});

// 捡货单
Route::group('pick_order', function () {
    Route::get('list', 'PickOrder/list');
    // 确认出库
    Route::post('modify', 'PickOrder/modify');
});

// 回库单
Route::group('return_order', function () {
    Route::get('list', 'ReturnOrder/list');
    // 签收/批准入库
    Route::post('check', 'ReturnOrder/check');
    // 上架
    Route::post('put_away', 'ReturnOrder/putAway');
    Route::post('import', 'ReturnOrder/import');
    Route::get('template', 'ReturnOrder/template');
});

// 采购单
Route::group('purchase_order', function () {
    Route::get('list', 'PurchaseOrder/list');
    Route::post('add', 'PurchaseOrder/add');
    // 签收入库
    Route::post('put_in','PurchaseOrder/putIn');
});

// 仓库
Route::group('warehouse', function () {
    Route::get('list', 'Warehouse/list');
    Route::post('add', 'Warehouse/add');
    Route::post('edit', 'Warehouse/edit');
    Route::post('modify', 'Warehouse/modify');
    Route::post('del', 'Warehouse/del');
});

// 库区
Route::group('warehouse_area', function () {
    Route::get('list', 'WarehouseArea/list');
    Route::post('add', 'WarehouseArea/add');
    Route::post('edit', 'WarehouseArea/edit');
    Route::post('modify', 'WarehouseArea/modify');
    Route::post('del', 'WarehouseArea/del');
});

// 库位
Route::group('warehouse_location', function () {
    Route::get('list', 'WarehouseLocation/list');
    Route::post('add', 'WarehouseLocation/add');
    Route::post('add_all', 'WarehouseLocation/addAll');
    Route::post('edit', 'WarehouseLocation/edit');
    Route::post('modify', 'WarehouseLocation/modify');
    Route::post('del', 'WarehouseLocation/del');
});

// 调拨单
Route::group('transfer_order', function () {
    Route::get('list', 'TransferOrder/list');
    // 调拨出库单
    Route::get('out_list', 'TransferOrder/outList');
    // 审核
    Route::post('check', 'TransferOrder/check');
    // 调拨入库单
    Route::get('in_list', 'TransferOrder/inList');
    // 模版
    Route::get('template', 'TransferOrder/template');
    Route::post('add', 'TransferOrder/add');
    Route::post('edit', 'TransferOrder/edit');
    Route::post('del', 'TransferOrder/del');
    // 生成捡货单
    Route::post('pick', 'TransferOrder/pick');
    // 调拨签收
    Route::post('sign', 'TransferOrder/sign');
    // 取消
    Route::post('cancel', 'TransferOrder/cancel');
    // 确认出库
    Route::post('check_out', 'TransferOrder/checkOut');
    // 导入
    Route::post('import', 'TransferOrder/import');
});

// 对账
Route::group('account', function () {
    // 司机对账列表
    Route::get('driver_list', 'Account/driverList');
    // 业务员对账列表
    Route::get('salesman_list', 'Account/salesmanList');
    // 经销商对账列表
    Route::get('dealer_list', 'Account/dealerList');
});

// 对账收款
Route::group('account_payment', function () {
    Route::get('list', 'AccountPayment/list');
    Route::get('amount', 'AccountPayment/amount');
    Route::post('add', 'AccountPayment/add');
    Route::post('del', 'AccountPayment/del');
    Route::post('check', 'AccountPayment/check');
    Route::post('export', 'AccountPayment/export');
});

// 付款单
Route::group('payment_order', function () {
    Route::get('list', 'AccountPaymentOrder/list');
    Route::get('amount', 'AccountPaymentOrder/amount');
    Route::post('add', 'AccountPaymentOrder/add');
    Route::post('del', 'AccountPaymentOrder/del');
    Route::post('check', 'AccountPaymentOrder/check');
});

// 报表
Route::group('report', function () {
    // 业务员销售统计
    Route::get('salesman', 'report.Sale/salesman');
    // 经销商销售统计
    Route::get('dealer_sale', 'report.Sale/dealer');
    // 门店销售统计
    Route::get('store_sale', 'report.Sale/store');
    // 经销商财务统计
    Route::get('dealer_finance', 'report.Finance/dealer');
    // 门店财务统计
    Route::get('store_finance', 'report.Finance/store');
    // 销售出库 采退出库
    Route::get('sale_out', 'report.Warehouse/out_list');
    // 调拨出库报表
    Route::get('transfer_out', 'TransferOrder/report');

    //销售入库 采退入库 
    Route::get('put_in_storage', 'report.Warehouse/put_in_storage');
    //update_dealer
    Route::post('update_dealer', 'report.Warehouse/update_dealer');

    Route::get('update_ck', 'report.Warehouse/update_ck');
    // 司机物流
    Route::get('driver', 'report.Logistics/driver');
    //经销商物流
    Route::get('dealer', 'report.Logistics/dealer');
    Route::get('export_excel', 'report.Logistics/export_excel');

    Route::get('update_company_order_detail', 'report.Warehouse/update_company_order_detail');
    Route::post('update_delivery_log', 'report.Logistics/update_delivery_log');
});

// 打印
Route::group('print', function () {
    Route::post('index', 'PrintLog/index');
});

// 个人中心
Route::group('personal', function () {
    Route::post('change_password', 'Personal/changePassword');
    Route::post('change_avatar', 'Personal/changeAvatar');
    Route::post('change_message', 'Personal/changeMessage');
});


Route::group('kanban', function () {
    Route::get('warehouse_overview', 'Kanban/warehouse_overview');
    Route::get('warehouse_data', 'Kanban/warehouse_data');
    Route::get('return_and_exchange', 'Kanban/return_and_exchange');
    Route::get('shipping_statistics', 'Kanban/shipping_statistics');
    Route::get('data_overview', 'Kanban/data_overview');
});

// 意见反馈管理
Route::group('feedback`', function () {
    Route::get('', 'Feedback/index');
    Route::post('add', 'Feedback/create');
});

// 帮助文档
Route::group('article', function () {
    Route::post('add', 'Article/create');
    Route::get('list', 'Article/index');
    Route::get('/:id', 'Article/show')->pattern(['id' => '\d+']);
    Route::get('search', 'Article/search');
    Route::post('delete/:id', 'Article/delete')->pattern(['id' => '\d+']);
    Route::post('update/:id', 'Article/update')->pattern(['id' => '\d+']);
    Route::get('categories', 'Article/categories');
    Route::get('category_search', 'Article/categoriesSearch');
    Route::post('category_add', 'Article/categoriesCreate');
    Route::post('category_update/:id', 'Article/categoriesUpdate')->pattern(['id' => '\d+']);
    Route::post('category_delete/:id', 'Article/categoriesDelete')->pattern(['id' => '\d+']);
});

// 消息通知
Route::group('message_notification', function () {
    Route::get('list', 'MessageNotification/messageNotifications');
    Route::get('/:id', 'MessageNotification/messageNotification')->pattern(['id' => '\d+']);
    Route::get('types', 'MessageNotificationType/index');
    Route::get('count', 'MessageNotification/unReadMessageCount');
});

